<template>
  <h1>我是app组件</h1>
  <h1>姓名：{{ name }}</h1>
  <h1>年龄：{{ age }}</h1>
  <h1>工作种类：{{ job.type }}</h1>
  <h1>月薪：{{ job.salary }}</h1>
  <button @click="changeInfo">修改人信息</button>
</template>

<script>
//引入ref成为响应式
import {ref} from "vue";

export default {
  name: 'App',
  setup() {
    let name = ref('张三')
    let age = ref(18)
    let job = ref({
      type:'后端工程师',
      salary:'100k'
    })

    function changeInfo() {
      name.value = '李四'
      age.value = 26
      job.value.type='产品经理'
      job.value.salary='500k'
    }

    return {
      name,
      age,
      changeInfo,
      job
    }
  }
}
</script>

<style>

</style>
